{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import pandas as pd\n",
    "import matplotlib.pyplot as plt\n",
    "from xgboost import XGBRegressor\n",
    "from sklearn.preprocessing import LabelEncoder"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "train_df=pd.read_csv('data/train.csv')\n",
    "test_df=pd.read_csv('data/test.csv')\n",
    "train_df.loc[:,'RoomDir']=LabelEncoder().fit_transform(train_df.loc[:,'RoomDir'])\n",
    "test_df.loc[:,'RoomDir']=LabelEncoder().fit_transform(test_df.loc[:,'RoomDir'])\n",
    "\n",
    "X_train=train_df.drop(['Rental'],axis=1)\n",
    "Y_train=train_df.loc[:,'Rental']\n",
    "X_test=test_df.drop(['id'],axis=1)\n",
    "test_id=test_df.loc[:,'id']\n",
    "\n",
    "xgb_reg=XGBRegressor(max_depth=5,n_estimators=500,n_jobs=-1)\n",
    "xgb_reg.fit(X_train,Y_train)\n",
    "Y_pred=xgb_reg.predict(X_test)\n",
    "\n",
    "sub=pd.DataFrame({\n",
    "    'id':test_id,\n",
    "    'price':Y_pred\n",
    "})\n",
    "sub.to_csv('baseline.csv',index=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.5.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
